import pymysql

db = pymysql.connect(host='localhost', port=3306,user='root', passwd='888888', db='test')

cursor = db.cursor()
cursor.execute("select version();")
res = cursor.fetchone()
print(res)

cursor.execute("create database if not exists spider charset=utf8mb4;")

db.close()